<?php require('includes/top.php'); ?>
<script type="text/javascript" src="jquery/jquery.min.js"></script>

        <style type="text/css">
        	#lightbox{
				display:none;
        		background:#000000;
				opacity:0.9;
				filter:alpha(opacity=90);
        		position:absolute;
				top:0px;
				left:0px;
				min-width:100%;
				min-height:100%;
				z-index:1000;
        	}
			#lightbox-panel{
				display:none;
				position:fixed;
				top:20px;
				left:30%;
				margin-left:-200px;
				width:70%;
				background:#FFFFFF;
				padding:10px 15px 10px 15px;
				border:2px solid #CCCCCC;
				z-index:1001;
				height: 90%;
			}
		</style>

		<script type="text/javascript">
			$(document).ready(function(){
				$("a#close-panel").click(function(){
					$("#lightbox, #lightbox-panel").fadeOut(300);
				})
			})
		</script>

<script type="text/javascript" src="jquery/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("a#show-panel").click(function()
{	
var test=this.getAttribute('href');
var dataString = 'test='+ test;

//alert(test);
$.ajax
({
type: "POST",
url: "ajax_vendor_profile.php",
data: dataString,
cache: false,
success: function(html)
{

	$("#lightbox, #lightbox-panel").fadeIn(300);
	$("#lightbox-panel").html(html);
	$("#close").show();
} 
});
});

$("#lightbox").click(function()
{
	$("#lightbox, #lightbox-panel").hide();
});
								  
});
</script>
<?php

if($_POST['con']!='' && $_POST['cat']!='')//query 4 both category and country selected
{

$country_id=$_POST['con'];
$category_id=$_POST['cat'];
//echo 'EXPERT NAME WHO BELONGS TO THE SELECTED COUNTRY AND CATEGORY'.'<br>';
$ans=mysql_query("select * from vendors where vendor_category_id=".$category_id."and country_id=".$country_id);
?>
<table width="50%">
<tr>
<td>
	<table border='0'>
		<tr>
			<th align="left">Vendors</th>
		</tr>
		<?php
		while($res=mysql_fetch_array($ans))
		{
		?>
		<tr>
			<td>
				<a href="#?<?php echo $result['vendors_id'];?>" id="show-panel"><?php echo $res['company_name']; ?></a>
				<br/>
				<?php echo $res['company_info']; ?>
			</td>
		</tr>
		<?php 
		} 
		?>
	</table>
</td>
<td valign="top">
	<table>
		<?php 
			$fv=mysql_query("select * from experts where expert_cat_id='3'"); 
			while($fvrow=mysql_fetch_array($fv))
			{
		?>
		<tr><td><a href="#" id="show-panel"><?php echo $fvrow['company_name']; ?></a></td></tr>
		<?php
			}
		 ?>
	</table>
</td>		
</tr>
</table>
<?php
}
elseif($_POST['con']!='')//query 4 only country selected
{
$country_id=$_POST['con'];
//echo 'EXPERT NAME WHO BELONGS TO THE SELECTED COUNTRY'.'<br>';
$ans=mysql_query("select * from vendors where country_id=".$country_id);
?>
<table width="50%">
<tr>
<td>
	<table border='0' width="100%">
	<tr><th align="left">Vendor</th></tr>
	<?php
	while($res=mysql_fetch_array($ans))
		{	
		?>
		<tr>
			<td><a href="#?<?php echo $res['vendors_id'];?>" id="show-panel"><?php echo $res['company_name']; ?></a>
				<br/>
				<?php echo $res['company_info']; ?>
			</td>
		</tr>
	<?php
		}
		?>
	</table>
</td>

<td valign="top" align="right">
	<table>
		<tr>
			<th align="left">Featured Experts</th>
		</tr>
		<?php 
			$f_experts=mysql_query("select * from experts where expert_cat_id='3'");
			while($f_rows=mysql_fetch_array($f_experts))
			{ 
		?>
		<tr><td><a href="#" id="show-panel"><?php echo $f_rows['company_name']; ?></a></td></tr>
		<?php
			}
		 ?>
	</table>
</td>

</tr>
</table>
<?php
}

?>